package String;

public class Jerque {

	public static void main(String[] args) {
		// 字符串生成器为了解决频繁添加字符串操作
		String str = "";
		long startTime = System.currentTimeMillis();
		for(int i=0;i<10000;i++) {
			str = str+i;
		}
		long endTime = System.currentTimeMillis();
		long time  = endTime - startTime;
		System.out.println("String消耗时间: "+time);
		
		StringBuilder  builder = new StringBuilder("");
		startTime = System.currentTimeMillis();
		for(int j=0;j<10000;j++) {
			builder.append(j);
		}
		
		endTime = System.currentTimeMillis();
		time  = endTime - startTime;
		System.out.println("StringBuilder消耗时间: "+time);
		

	}

}
